package org.logan.sample.web.main.service.system.impl;

import java.util.List;

import org.logan.sample.db.dao.SysConfigMapper;
import org.logan.sample.db.model.SysConfig;
import org.logan.sample.web.main.service.system.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Desc：系统配置service实现
 * @Title：SysConfigServiceImpl
 * @author: zhaoyy
 * @version: 1.0
 * @date: 2016年11月2日 下午4:08:06
 */
@Service
public class SysConfigServiceImpl implements SysConfigService {
	@Autowired
	private SysConfigMapper sysConfigMapper;

	@Override
	public SysConfig getCfgBykey(String cfgKey) {
		return sysConfigMapper.selectByCfgKey(cfgKey);

	}

	@Override
	public List<SysConfig> getCfgsByName(String cfgName) {
		return sysConfigMapper.selectByCfgName(cfgName);
	}

	@Override
	public int updateCfgBykey(SysConfig cfg) {
		return sysConfigMapper.updateByPrimaryKeySelective(cfg);
	}

	@Override
	public int savaCfg(SysConfig cfg) {
		return sysConfigMapper.insert(cfg);

	}
}
